package com.jh.complicate.rpc.v1.client;

import java.lang.reflect.Proxy;

/**
 * @author Administrator
 * @projectName newforward
 * @title RPCProxyClient.java
 * @package com.jh.complicate.rpc.v1.client
 * @description 客户端动态代理
 * @date 2019/6/12 00:02
 */
public class RPCProxyClient {

    public <T> T clientProxy(final Class<T> interfaceClass, final String host, final int port) {
        return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(),
                new Class<?>[]{interfaceClass},
                new RemoteInvocationHandler(host, port));
    }

}
